package com.clothing.dao.impl;

import java.util.List;

import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;

import org.springframework.stereotype.Repository;

import com.clothing.dao.ArticleTypeDao;
import com.clothing.entity.ArticleType;

/**
 * @ClassName: ArticleTypeDaoImpl 
 * @Description: TODO(Dao) 
 * @author Charles.Tao 
 * @date 2017年9月6日 下午3:40:20 
 * @version 1.0
 */
@Repository
public class ArticleTypeDaoImpl extends BaseDaoImpl<ArticleType, Long> implements ArticleTypeDao
{
    @Override
    public List<ArticleType> findShowList()
    {
        CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
        CriteriaQuery<ArticleType> criteriaQuery = criteriaBuilder.createQuery(ArticleType.class);
        Root<ArticleType> root = criteriaQuery.from(ArticleType.class);
        criteriaQuery.select(root);
        criteriaQuery.where(criteriaBuilder.equal(root.get("isShow"), Boolean.TRUE));
        return findList(criteriaQuery, null, null, null, null);
    }
}
